﻿using System.Web.Mvc;
using System.Web.Routing;
using SharpArch.Web.Areas;

namespace MindMelder.Web.Controllers
{
	public class RouteRegistrar
	{
		public static void RegisterRoutesTo(RouteCollection routes) {
			routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
			routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });

			// The areas below must be registered from greater subareas to fewer;
			// i.e., the root area should be the last area registered

			// Example illustrative routes with a nested area - note that the order of registration is important
			//routes.CreateArea("Organization/Department", "MindMelder.Web.Controllers.Organization.Department",
			//    routes.MapRoute(null, "Organization/Department/{controller}/{action}", new { action = "Index" }),
			//    routes.MapRoute(null, "Organization/Department/{controller}/{action}/{id}")
			//);
			//routes.CreateArea("Organization", "MindMelder.Web.Controllers.Organization",
			//    routes.MapRoute(null, "Organization/{controller}/{action}", new { action = "Index" }),
			//    routes.MapRoute(null, "Organization/{controller}/{action}/{id}")
			//);

			// Routing config for the root area
			routes.CreateArea("Root", "MindMelder.Web.Controllers",
				routes.MapRoute(null, "",
					new { controller = "Home", action = "Index" }),
				routes.MapRoute(null, "Login",
					new { controller = "Home", action = "Login" }),
				routes.MapRoute(null, "{controller}/{action}",
					new { controller = "Home", action = "Index" }),
				routes.MapRoute("404-PageNotFound", "{*url}",
					new { controller = "StaticContent", action = "PageNotFound"})
			);
		}
	}
}
